﻿<%@ Page Title="Thống kê Log" Language="C#" MasterPageFile="~/App_MasterPages/Aquarius.Master"
    AutoEventWireup="true" CodeBehind="LogManagement.aspx.cs" Inherits="SMSROUTER.UI.LogManagement"  %>

<%@ Register Src="../UserControl/ucPaging.ascx" TagName="ucPaging" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CssContent" runat="server">
    <style type="text/css">
        a.subs{color: #696969;text-decoration: none;}
        a.subs:hover{text-decoration: underline;}
        .table2 tr.fail td{background: #FC9C9C !important;}
        .table2 tr.pending td{background: #749DC9 !important;}
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
           DatePicker("txtFromDate,txtToDate");
       });
       
       function CheckSearch() {
           var fromTime = $("[id$=txtFromDate]").datepicker('getDate');
           var toTime = $("[id$=txtToDate]").datepicker('getDate');
           if (fromTime == null || toTime == null) {
               $("#ltrCheckSearch").html("Bắt buộc chọn thời điểm đầu và thời điểm cuối");
               return false;
           }
           else {
               if (toTime < fromTime) {
                   $("#ltrCheckSearch").html("Thời điểm cuối không được nhỏ hơn thời điểm đầu");
                   return false;
               }
               fromTime.setMonth(fromTime.getMonth() + 3);
               if (fromTime < toTime) {
                   $("#ltrCheckSearch").html("Giới hạn khoảng tìm kiếm là 3 tháng");
                   return false;
               }
           }
           $("#ltrCheckSearch").html("");
           return true;
       }
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div class="row-fluid">
        <div class="span12">
            <div class="head">
                <div class="isw-grid">
                </div>
                <h1>
                    Điều kiện tìm kiếm</h1>
                <div class="clear">
                </div>
            </div>
            <div class="block-fluid" style="padding: 10px 0px 5px 10px">
                <table cellspacing="0" cellpadding="0" width="100%">
                    <tbody>
                        <tr>
                            <td> Từ ngày</td>
                            <td><asp:TextBox ID="txtFromDate" runat="server" /></td>
                            <td> đến ngày</td>
                            <td>
                                <asp:TextBox ID="txtToDate" runat="server" />
                                <span style="color:Red"> (Khoảng tìm kiếm tối đa 3 tháng)</span>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <div style="text-align: center">
                    <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" OnClick="btnSearch_Click"
                        CssClass="btn" OnClientClick="return CheckSearch();" />
                </div>
                <div style="text-align: center; color: Red">
                    <span id="ltrCheckSearch"></span>
                </div>
            </div>
        </div>
    </div>
    <div class="row-fluid">
        <div class="span12">
            <div class="head">
                <div class="isw-grid">
                </div>
                <h1>Thống kê</h1>
                <div class="clear">
                </div>
            </div>
            <div class="block-fluid table-sorting">
                <div role="grid" class="table2" id="tSortable_wrapper">
                    <div class="dataTables_length">
                        <label>
                            Hiển thị
                            <asp:DropDownList ID="tSortable_length" size="1" aria-controls="tSortable" runat="server"
                                OnSelectedIndexChanged="tSortable_length_SelectedIndexChanged" AutoPostBack="true" onchange="if(!CheckSearch()) return false;">                                        
                                <asp:ListItem Value="50" Selected="True">50</asp:ListItem>
                                <asp:ListItem Value="100">100</asp:ListItem>
								<asp:ListItem Value="150">150</asp:ListItem>
								<asp:ListItem Value="200">200</asp:ListItem>
								<asp:ListItem Value="300">300</asp:ListItem>
                            </asp:DropDownList>
                            dòng</label>
                    </div>
                    <div>
                        <uc1:ucPaging ID="pagingtop" runat="server"  Visible="false"/>
                    </div>
                    <asp:GridView ID="grvData" runat="server" CssClass="dataTables_wrapper table2 dataTable" aria-describedby="tSortable_info"
                        AutoGenerateColumns="false" ShowHeaderWhenEmpty="true">
                        <Columns>
                            <asp:TemplateField HeaderText="STT" ItemStyle-CssClass="STT">
                                <ItemTemplate>
                                    <%#(Container.DataItemIndex + 1) + (pagingtop.CurrentPage - 1) * pagingtop.PageSize%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField HeaderText="Log Type" DataField="LogType" ItemStyle-CssClass="width1"/>
                            <asp:BoundField HeaderText="Log Message" DataField="LogMessage"/>
                            <asp:BoundField HeaderText="Log Time" DataField="LogTime" DataFormatString="{0:dd/MM/yyyy HH:mm:ss}" ItemStyle-CssClass="DateTime2"/>
                            <%--<asp:BoundField HeaderText="Log Trace" DataField="LogTrace" ItemStyle-CssClass="width3"/>--%>
                            <asp:BoundField HeaderText="Log Source" DataField="LogSource" ItemStyle-CssClass="width1"/>
                        </Columns>    
                    </asp:GridView>
                    <div class="dataTables_info" id="tSortable_info">
                        <asp:Literal ID="ltrInfo" runat="server" />
                    </div>
                    <div class="dataTables_paginate paging_full_numbers" id="tSortable_paginate">
                        <uc1:ucPaging ID="pagingbottom" runat="server"  Visible="false"/>
                    </div>
                </div>
                <div class="clear">
                </div>
            </div>
        </div>
    </div>
</asp:Content>
